/**
 * 
 */
package com.yi.backend.db.initial.impl;

import com.yi.backend.db.api.IMongoDBHelperApi;
import com.yi.backend.db.initial.IInitializeApi;
import com.yi.backend.ui.config.api.IUIConfigApi;
import com.yi.backend.model.api.IBusinessModelApi;
/**
 * @author long
 *
 */
public class MongoInitializeApi implements IInitializeApi{

	private IMongoDBHelperApi mongoDBHelperApi;
	private IUIConfigApi mongoUIConfigApi;
	private IBusinessModelApi mongoBusinessModelApi;
	
	public IMongoDBHelperApi getMongoDBHelperApi() {
		return mongoDBHelperApi;
	}
	public void setMongoDBHelperApi(IMongoDBHelperApi mongoDBHelperApi) {
		this.mongoDBHelperApi = mongoDBHelperApi;
	}
	public IUIConfigApi getMongoUIConfigApi() {
		return mongoUIConfigApi;
	}
	public void setMongoUIConfigApi(IUIConfigApi mongoUIConfigApi) {
		this.mongoUIConfigApi = mongoUIConfigApi;
	}

	@Override
	public void createBasicTables() {
		// TODO Auto-generated method stub
		getMongoDBHelperApi().createDBTableByName("tableNames");
		getMongoDBHelperApi().createDBTableByName(IBusinessModelApi.roleSchemaName);
		getMongoDBHelperApi().createDBTableByName(IBusinessModelApi.userSchemaName);
		getMongoDBHelperApi().createDBTableByName(IUIConfigApi.schemaName);
	}

	@Override
	public void insertBasicData() {
		// TODO Auto-generated method stub
		
		getMongoUIConfigApi().initialBasicUIConfigs();
		
		getMongoBusinessModelApi().initialRoles();
		
		getMongoBusinessModelApi().initialUsers();
	}
	public IBusinessModelApi getMongoBusinessModelApi() {
		return mongoBusinessModelApi;
	}
	public void setMongoBusinessModelApi(IBusinessModelApi mongoBusinessModelApi) {
		this.mongoBusinessModelApi = mongoBusinessModelApi;
	}
	

}
